package daobeauty.interceptor.returntype.executor;

import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SQLQuery;

import daobeauty.dao.Limiting;
import daobeauty.dao.Sorting;
// TODO scrollableresult als eine executionstrategy implementieren
/**
 * The ExecutionStrategy interface allows the execution of different kinds of hibernate queries with Limiting and/or Sorting.<br/>
 * Examples for ExecutionStrategies are:<br/>
 * <dir>
 * <li>Query.list()</li>
 * <li>Query.uniqueResult()</li>
 * <li>SQLQuery.list()</li>
 * <li>SQLQuery.uniqueResult()</li>
 * <li>Criteria.list()</li>
 * <li>Criteria.uniqueResult()</li>
 * </dir>
 * Up to come:<br/>
 * <dir>
 * <li>Query.scroll()</li>
 * <li>SQLQuery.scroll()</li>
 * <li>Criteria.scroll()</li>
 * </dir>
 * An execution strategy is also responsible of:<br/>
 * <dir>
 * <li>converting the result to some type, that the proxied method will return</li>
 * <li>applying limiting and sorting</li>
 * </dir>
 * 
 * @see Query#list()
 * @see Query#uniqueResult()
 * @see Query#scroll()
 * @see SQLQuery#list()
 * @see SQLQuery#uniqueResult()
 * @see SQLQuery#scroll()
 * @see Criteria#list()
 * @see Criteria#scroll()
 * @see Criteria#uniqueResult()
 * @author M. Serhat Cinar
 *
 */
public interface ExecutionStrategy {
	public Object execute(Object criteriaOrQueryOrSqlQuery, Limiting limiting, Sorting sorting);
}
